package com.computergames.server.service.getCurrentPlayerStrategy;

import org.springframework.stereotype.Service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@Service
public class Bid_GetCurrentPlayerStrategySelector {
    private final Map<String, Bid_GetCurrentPlayerStrategy> strategyMap = new ConcurrentHashMap<>();

    public Bid_GetCurrentPlayerStrategySelector()
    {
        strategyMap.put("斗地主", new Bid_GetLandlordCurrentPlayer());
    }

    public boolean select(String roomName,String player, int bid, String roomType)
    {
        Bid_GetCurrentPlayerStrategy strategy = strategyMap.get(roomType);
        if (strategy == null)
        {
            throw new IllegalArgumentException("No strategy found for room type: " + roomType);
        }
        return strategy.getCurrentPlayer(roomName, player, bid);
    }
}
